package com.yeeverse.api.demo.test.saas;

import com.alibaba.fastjson.JSON;
import com.yeeverse.sdk.api.PaycenterApi;
import com.yeeverse.sdk.util.DateUtils;
import com.yeeverse.sdk.vo.api.saas.SaasCashierRequestDTO;
import org.junit.Test;

import java.util.Map;

/**
 * @Author: XiongGaoXiang
 * @Date: 2023/2/27
 */
public class CommonPayTest_1020000189025321 {

    /**
     * 发起方商编
     */
    private static String parentMerchantNo = "1020000189025321";
    /**
     * 交易商编
     */
    private static String merchantNo = "1020000189025321";

    /**
     * 下单获取收银台地址
     */
    @Test
    public void cashierTest() throws Exception {
        SaasCashierRequestDTO requestDTO = new SaasCashierRequestDTO();
        requestDTO.setParentMerchantNo(parentMerchantNo);
        requestDTO.setMerchantNo(merchantNo);
        requestDTO.setMerchantOrderNo("SAAS1234567890");
        requestDTO.setRequestNo("SAAS" + System.currentTimeMillis());
        requestDTO.setOrderAmount("2.00");
        requestDTO.setAssureType("ASSURE");
        requestDTO.setUserId("123123");
//        requestDTO.setUserType("personal");
        requestDTO.setTimeoutExpress("30");
        requestDTO.setRequestTime(DateUtils.getCurrentTime());
        requestDTO.setGoodsInfo("生椰拿铁");
        requestDTO.setNotifyUrl("http://10.171.3.100:9092/testCallback");
        requestDTO.setRedirectUrl("http://baidu.com/redirect");
        requestDTO.setPayScene("H5");
        requestDTO.setClientIp("127.0.0.1");
        requestDTO.setCurrency("RMB");
        requestDTO.setOrderType("singlePay");
        requestDTO.setSupportApiPay("false");
        requestDTO.setShowPoint("true");
        requestDTO.setShowCoupon("true");
        requestDTO.setShowWallet("true");
        requestDTO.setPayerInfo("{\"idCardNo\":\"130225199006093323\"}");
        System.out.println("请求参数" + JSON.toJSONString(requestDTO));
        Map mapRspDataVO = new PaycenterApi().baseRequest(requestDTO, "/V2/rest/cashier", Map.class);
        System.out.println("解密response报文：" + JSON.toJSONString(mapRspDataVO));
    }



}
